Skip to main content

All Questions

2votes
3answers
614views

Bifurcating recursive calculation with redundant calculations

def T(n): if n <= 0: return 1 else: return T(n-1) + (n-1) * T(n-2) print T(4) I need an effective way to print out the output of the function <...
Justin's user avatar
  • 2,585
12votes
3answers
2kviews

Finding the prime factors of a number in Python 2

I’ve created a function that takes a number and, if it’s prime, tells you so, or if it’s composite, gives you the prime factors of the number (and if it’s 1, tells you that it’s neither). ...
Fivesideddice's user avatar
0votes
1answer
540views

Image color-moment extractor [closed]

I was just wondering if there is a way to speed up the performances of this for loops in Python. I'm trying to process an image to get the color-moments without using libraries. It takes about 12sec ...
Enrico Mosca's user avatar
3votes
1answer
300views

Estimation of min_samples for DBSCAN

I'm attempting to speed up some python code that is supposed to automatically pick the minimum samples argument in DBSCAN. Currently the execution time grows exponentially as the number of training ...
random_dsp_guy's user avatar
4votes
1answer
338views

Store special deals, like 3 for 2

I have to apply two deals on the cart. Buy 3 (equal) items and pay for 2 Buy 3 (in a set of items) and the cheapest is free Items in cart: ...
Ciasto piekarz's user avatar
1vote
1answer
210views

Reading employee data from a PostgreSQL database

I have developed this script to read employee_language table records of a PostgreSQL database using Python 2 (due to some OS limitation). I want to find duplicate ...
Ibrahim Rahimi's user avatar
1vote
1answer
246views

Django view of reward points that heavily filters and sorts (many) database results

My page (even when it has no data) takes 10+ seconds to load. That's just too long, considering when you finally get to it there's no data. When it has data, it takes even longer. Here is my view, ...
Helana Brock's user avatar
2votes
0answers
123views

Extract cell values from multiband rasters

I have the following function and code snippet to extract cell values for multiple years, format it, and save to a list. Each raster has 365 bands — one for each day. A separate operation is performed ...
Ibe's user avatar
  • 121
5votes
1answer
1kviews

Improving the speed of creation for three Perlin Noise Maps in Python?

I am interested in learning how I can improve the speed of the code in this pygame file. I iterate over 6400 * 1800 * 3 or 34,560,000 elements of various numpy arrays here to apply noise values to ...
LuminousNutria's user avatar
7votes
1answer
1kviews

Plotting terrain pixels with PyGame based on random NumPy array

I am experimenting with Perlin Noise and random map generation. I have a 2D numpy ndarray full of 16-bit floats called map_list that I call from the singleton ...
LuminousNutria's user avatar
2votes
1answer
101views

Application to monitor device power levels for deviations

I have a high performance, computation intensive application that runs on a Centos 7 machine with Python 2.7.5. I'll try to explain what the application does: The application runs an infinite loop, ...
Inian's user avatar
1vote
1answer
97views

Python Firewall-Connection-Event Filter too slow

I've written a little piece of code to filter Firewall-Connection-Events by a certain group of IPs. But the code can't keep up since the input is fairly huge. I am looking for ways to make this code ...
peacemaker's user avatar
2votes
1answer
62views

Looping text in Python with directional control

The code is an implementation of looping text (similar to a circular buffer - wraps around when it reaches the edge of the defined bounds) with directional control. The code is functional and works ...
user avatar
-1votes
1answer
252views

Decoding a string encoded by Caesar Cipher and some delimiters [closed]

I have the following code which I seek to optimize. The result of the bruteforce I already have but I'm just trying to learn some more python using the same example. The code in the data needs to be ...
BartD's user avatar
1vote
1answer
152views

Printing all the factors as well as the prime factors of a given number using Python 2.7.x

Okay here is my maiden attempt at programming using Python 2.7. I need help or feedback on this code: How do I know about the processing cycles this program consumes? How do I implement this idea ...
Mohammed Javed Akhtar's user avatar

153050per page
close